package com.qrsx.handle;

import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.servlet.ModelAndView;

import com.qrsx.service.CityRunTimeEx;

@ControllerAdvice
public class ExceptionController {
	
	@ExceptionHandler({Exception.class})
	public ModelAndView handleException(Exception exception){
		ModelAndView mv = new ModelAndView("error");
		mv.addObject("exception", exception);
		return mv;
	}
	
	
	@ExceptionHandler({CityRunTimeEx.class})
	public ModelAndView handleArithmeticException(Exception exception){
		ModelAndView mv = new ModelAndView("error");
		mv.addObject("exception", exception.getMessage());
		return mv;
	}
}
